package question.T0215_2_UIKit;

public class ReflectUtil {

    // 根据完整的类名，调用无参构造函数，生成一个实例
    public static Object createObjectFromClassName(String className) {
        try {
            Class<?> clazz = Class.forName(className);
            return clazz.getDeclaredConstructor().newInstance();
        } catch (Exception e) {
            throw new RuntimeException("无法实例化类: " + className, e);
        }
    }
}
